package com.orhon.smartcampus.modules.student.mm;

import java.util.List;

import com.orhon.smartcampus.modules.base.mm.SchoolMapper;
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import com.orhon.smartcampus.modules.base.mm.DictionaryMapper;
import com.orhon.smartcampus.modules.base.mm.LangMapper;
import com.orhon.smartcampus.modules.base.mm.RegionMapper;
import com.orhon.smartcampus.modules.student.entity.Eclass;
import com.orhon.smartcampus.modules.student.gqlModel.GQLEclass;

@Mapper(
        uses = {
                LangMapper.class,
                RegionMapper.class,
                DictionaryMapper.class,
                SchoolMapper.class,
                StudentMapper.class
        }
)
public interface EclassMapper {

    EclassMapper MAPPER = Mappers.getMapper(EclassMapper.class);

    
    @Mapping(source = "id" , target = "id")
    @Mapping(source = "eclassCode" , target = "code")
    @Mapping(source = "classStatus" , target = "status")
    @Mapping(source = "classKindDict" , target = "kind_dict", qualifiedByName = "str2dic")
    @Mapping(source = "classNature" , target = "nature", qualifiedByName = "str2dic")
    @Mapping(source = "graduatedFlag" , target = "graduated_flag")
    @Mapping(source = "eclassOrder" , target = "eclass_order")
    @Mapping(source = "eclassNumber" , target = "eclass_number")
    @Mapping(source = "iocPath" , target = "ioc_path")
    @Mapping(source = "logo" , target = "logo")
    @Mapping(source = "eclassName" , target = "name") //lang
    @Mapping(source = "introduction" , target = "intro")//lang
    @Mapping(source = "teacherComment" , target = "teacher_comment")//lang
    @Mapping(source = "headteacherMessage" , target = "head_teacher_message")//lang
    @Mapping(ignore = true, target = "school" )
    @Mapping(ignore = true, target = "grade" )
    @Mapping(ignore = true, target = "arrives" )
    @Mapping(ignore = true, target = "building" )
    @Mapping(ignore = true, target = "unit" )
    @Mapping(ignore = true, target = "floor" )
    @Mapping(ignore = true, target = "classroom" )
    @Mapping(ignore = true, target = "head_teacher" )
    @Mapping(ignore = true, target = "students" )
    //@Mapping(ignore = true , target = "province_id")
    GQLEclass toEclass(Eclass entity);
    
    
    @InheritConfiguration(name = "toEclass")
    List<GQLEclass> toEclassList(List<Eclass> entities);



}
